import { onMounted, ref } from 'vue';
import Cropper from 'cropperjs';
// import 'cropperjs/dist/cropper.css';

export default function useCropper(src: string) {
  const cropper = ref<Cropper | null>(null);

  onMounted(() => {
    const image = new Image();

    image.src = src;
    cropper.value = new Cropper(image!, {
      container: '.cropper-container'
    });
  });

  return { cropper };
}
